package test;

public class OddNumberCount {
    public static void main(String[] args) {
        int number = 4;
        int oddNumberSum = oddNumberSum(number);
        System.out.println(oddNumberSum);
    }
    private static int oddNumberSum(int number) {
        int sum = 0;
        for (int i = 1; i <= number ; i++) {
            if (i % 2 != 0){
                sum += i;
            }
        }
        return sum;
    }
}
